Skip to content

[SVLS-9300] ecs-fargate uninstrument command - #2505

Merged
ojproductions merged 3 commits into
onzia/ecs-instrument-command-04from
onzia/ecs-instrument-command-05
Sep 25, 2026
Merged

ojproductions merged 3 commits into
onzia/ecs-instrument-command-04from
onzia/ecs-instrument-command-05

Conversation

@ojproductions

@ojproductions ojproductions commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

What and why?

Adds datadog-ci ecs-fargate uninstrument, which removes Datadog instrumentation from an ECS Fargate task definition: it strips changes added by instrument added and registers the result as a new revision. Running tasks do not change until that revision is deployed.

How?

Same targeting and rollout as instrument (--task-definition, --region,
--profile, --ecs-service, --cluster, --dry-run, datadog-ci.json). The
transform drops:

  • the datadog-agent and datadog-log-router sidecars
  • the dd-sockets volume and its mounts
  • every DD_-prefixed environment variable and secret, plus ECS_FARGATE
  • the com.datadoghq.tags.service / env / version Docker labels (Autodiscovery
    labels are left alone)
  • the service, env, version, and dd_sls_ci revision tags

--env-vars names extra variables to remove. Fields declared by containers
themselves keep their position and value. Uninstrumenting a revision this
command registered should revert back to the task definition it was registered from.

A FireLens log configuration is not restored: the original driver is recorded nowhere, so the container is left with none and the command warns.
A task definition with nothing Datadog-owned to remove is reported as such and no revision is registered.

Beta: requires DD_BETA_COMMANDS_ENABLED=1.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

@ojproductions
ojproductions added this pull request to stack #2464 September 10, 2026 17:00
@ojproductions
ojproductions requested review from a team as code owners September 10, 2026 17:00

@domalessi domalessi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some editorial feedback, but approving so you're not blocked on me!

Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/plugin-ecs-fargate/README.md Outdated
Comment thread packages/datadog-ci/README.md Outdated
@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch from 23b7b7c to f3527aa Compare September 10, 2026 20:12
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 019b037 | Docs | View more details | Give us feedback!

@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch from f3527aa to 74f96fc Compare September 11, 2026 14:12
@ojproductions
ojproductions requested a review from a team as a code owner September 11, 2026 15:06
@ojproductions ojproductions added the serverless Related to [aas, cloud-run, lambda, stepfunctions, ecs-fargate] label Sep 11, 2026
@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch from 1ba378a to 16a69f6 Compare September 14, 2026 18:10
@ojproductions
ojproductions requested a review from stzou September 14, 2026 18:20
@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch 2 times, most recently from b7b545e to a38dc36 Compare September 15, 2026 19:44
@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch from a38dc36 to da22cf5 Compare September 16, 2026 20:08

@stzou stzou left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left three non-blocking comments on efficiency/reuse - happy to see them addressed here or in a follow-up.

*/
export const resolveApps = async (
client: ECSClient,
config: EcsFargateConfigOptions,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describeService sends one service per DescribeServicesCommand, even though the API accepts up to 10. Batching --ecs-service names in groups of 10 would cut API calls and rate-limit risk on large fleets.

// The driver routes to the log router, which is being removed, so a container left with it would
// start no tasks. What it was configured with before log collection was turned on is recorded
// nowhere, so the container is left with none rather than with a guess.
const firelens = container.logConfiguration?.logDriver === AWSFIRELENS_LOG_DRIVER

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This drops any awsfirelens container as if it must route through datadog-log-router, but it could be a customer's own Firelens setup. Reuse isDatadogFirelens() (checks options.Name === DATADOG_FLUENTBIT_OUTPUT) so we don't delete and mis-attribute a config we didn't add.

/**
* The sidecars instrumentation adds, which are keyed by name.
*/
const isSidecar = (container: ContainerDefinition): boolean =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sidecar name set is defined three times: SIDECAR_CONTAINER_NAMES (line 678), the inline checks in instrumentTaskDefinition's flatMap (lines 854/858), and isSidecar here. Worth having all three reuse SIDECAR_CONTAINER_NAMES so adding a sidecar can't miss one spot.

@Drarig29 Drarig29 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename the PR so it looks better in the changelog? 🙏

@Drarig29 Drarig29 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ojproductions ojproductions changed the title uninstrument command ecs-fargate uninstrument command Sep 18, 2026
@ojproductions ojproductions changed the title ecs-fargate uninstrument command [SVLS-9300] ecs-fargate uninstrument command Sep 18, 2026
@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch from da22cf5 to 5e50c79 Compare September 21, 2026 16:38
Apply the README editorial comments and unblock CI by matching the plugin version and dry-run snapshot to current instrumentation output.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ojproductions
ojproductions force-pushed the onzia/ecs-instrument-command-05 branch from 5e50c79 to 904d2c8 Compare September 21, 2026 16:40
@ojproductions
ojproductions merged commit b15887d into master Sep 25, 2026
65 of 66 checks passed
@ojproductions
ojproductions deleted the onzia/ecs-instrument-command-05 branch September 25, 2026 18:31
@Drarig29 Drarig29 mentioned this pull request Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

serverless Related to [aas, cloud-run, lambda, stepfunctions, ecs-fargate]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants